/**
 * 
 */
package com.ctn.bootstarp.tags.ui;

import java.text.MessageFormat;

/**
 * @author weiqi
 * @date 2013年8月7日
 */
public class TabItem {
	public static String htmlHeadTemp = "<li{0}><a href=\"#{1}\">{2}</a></li>";
	public static String htmlContentTemp = "<div id=\"{0}\" class=\"tab-pane{1}\">{2}</div>";
	public static String headActived = " class=\"active\"";
	public static String contentActived = " active";
	
	private Boolean actived;
	private String title;
	private String code;
	private String content;
	
	/**
	 * @param actived
	 * @param title
	 * @param code
	 * @param content
	 */
	public TabItem(Boolean actived, String title, String code, String content) {
		if(null==actived) {
			actived = false;
		}
		this.actived = actived;
		this.title = title;
		this.code = code;
		this.content = content;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	public String getHtmlHead(){
		return MessageFormat.format(htmlHeadTemp, actived?headActived:"",code,title);
	}
	
	public String getHtmlContent(){
		return MessageFormat.format(htmlContentTemp, code,actived?contentActived:"",content);
	}

}
